package com.rainng.coursesystem.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.rainng.coursesystem.model.bo.Homework;
import com.rainng.coursesystem.model.entity.AnswerEntity;
import com.rainng.coursesystem.model.entity.HomeworkEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AnswerMapper extends BaseMapper<AnswerEntity> {

    @Select("select count(*) from rc_answer where homework_id=#{homeworkId}")
    Integer getCountByHomeworkId(Integer homeworkId);
    @Select("select * from rc_answer where id=#{id}")
    AnswerEntity getById(Integer id);
    @Select("select homework_id from rc_answer where student_id=#{studentId}")
    List<Integer> getHomeworkIdListByStudentId(Integer studentId);
    @Select("select * from rc_answer where student_id=#{studentId}")
    List<AnswerEntity> getByStudentId(Integer studentId);
}
